<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <div>
      文件上传功能测试

      <input type="file" name="上传" id="file1" />
      <button onclick="uploadFile()">上传</button>
    </div>
  </body>
  <script>
    function uploadFile() {
      let file = document.getElementById('file1').files[0]
      console.log('files==', file)

      let fileData = new FormData()
      fileData.append('fileTest', file, '我是文件名哈哈哈')
      console.log('fileData==', fileData)
    }
  </script>
</html>
